import { Component, OnInit } from '@angular/core';
// import { NzMessageService } from 'ng-zorro-antd';
import {
  FormBuilder,
  FormGroup,
  FormControl
} from '@angular/forms';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
  isCollapsed = true;
  validateForm: FormGroup;
  controlArray = [];
  title = 'app';
  constructor(private fb: FormBuilder,
    // private _message: NzMessageService
  ) {
    // this._message.info('这是一条普通的提醒');
  }

  _submitForm() {
    for (const i in this.validateForm.controls) {
      this.validateForm.controls[i].markAsDirty();
    }
  }

  ngOnInit() {
    this.validateForm = this.fb.group({});
    for (let i = 0; i < 10; i++) {
      this.controlArray.push({ index: i, show: i < 6 });
      this.validateForm.addControl(`field${i}`, new FormControl());
    }
  }
}
